<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>好友搜索</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <!--semantic-ui-->
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
</head>
<body>
<br>

<div class="demoTable layui-container">
    <div class="layui-inline">
        <input class="layui-input"  id="username" autocomplete="off" placeholder="搜索用户名">
    </div>
    <button class="layui-btn" data-type="reload" id="search">搜索</button>
</div>

<br>
<div class="ui container" >
    <div class="ui segment">
        <div class="ui feed">

            <div class="event" th:each="user:${users}">
                <div class="label">
                    <img th:src="@{'/show/'+${user.getId()}}">
                </div>
                <div class="content">
                    <div class="summary">
                        <a class="user">
                            [[${user.getUsername()}]]
                        </a>
                    </div>
                    <div class="meta" th:if="${session.loginuser.getId()!=user.getId()}">
                        <a class="like" th:href="@{'/tea/friends/add/'+${user.getId()}}">
                            <i class="add user icon"></i> 加好友
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script>
    $(document).ready(function () {
        $('#search').click(function () {
            var username=$('#username').val();

            location.href = '/tea/friends/search?username=' + username;
        })
    })
</script>
</html>